<template>
  <div>
    <el-row>
      <el-col :span="12" class="charts-box">
        <ve-line :data="chartData" height="400px" class="charts-border" />
        <ve-histogram :data="chartData" height="400px" />
      </el-col>
      <el-col :span="12" class="charts-box">
        <ve-pie :data="chartData" height="400px" class="charts-border" />
        <ve-radar :data="chartData" height="400px" />
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { getData } from '@/api/dashboard.js'
export default {
  data() {
    return {
      chartData: {
        columns: ['日期', '新闻数量', '轮播图数量'],
        rows: []
      }
    }
  },
  mounted() {
    this.iniChart()
  },
  methods: {
    async iniChart() {
      const res = await getData()
      this.chartData.rows = res.data.map(item => {
        return {
          '日期': item.date,
          '新闻数量': item.newsCount,
          '轮播图数量': item.bannerCount
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped></style>
